package view
{
	
	import flash.text.*;
	import flash.display.*;
	
	import manager.ViewMgr;
	
	/**
	 * -- MainMenuView --
	 * @desc	view of the menu at left side of stage
	 * @author	Aqua (built on 2011-11-09)
	 */
	public class MainMenuView extends BaseView
	{
		//---------------------//
		//     Constructor     //
		//---------------------//
		
		/**************************************************************************
		 * -- MainMenuView --
		 * @desc		constructor
		 * @param		main view object of this view class
		 *************************************************************************/
		public function MainMenuView(viewComponent:DisplayObjectContainer):void
		{
			super(viewComponent);
			
			_viewComponent.name = VIEW_NAME;
			
			addAddCmd("txt",	add_txt);
			addAddCmd("btn_0",	add_btn);
			addAddCmd("btn_1",	add_btn);
			addAddCmd("btn_2",	add_btn);
			addAddCmd("btn_3",	add_btn);
			addAddCmd("btn_4",	add_btn);
			addAddCmd("btn_5",	add_btn);
			addAddCmd("btn_6",	add_btn);
			
			addClickCmd("btn_0",	click_btn);
			addClickCmd("btn_1",	click_btn);
			addClickCmd("btn_2",	click_btn);
			addClickCmd("btn_3",	click_btn);
			addClickCmd("btn_4",	click_btn);
			addClickCmd("btn_5",	click_btn);
			addClickCmd("btn_6",	click_btn);
			
			_txtList = [
				"编成",
				"探险",
				"决斗",
				"履历",
				"合成",
				"贩卖",
				"排行",
			];
		}
		
		//------------------//
		//     Privates     //
		//------------------//
		
		//-- Add Handlers --//
		private function add_txt():void
		{
			var txt:TextField;
			var index:int;
			
			txt = TextField(_display);
			index = getIndex(_display);
			txt.mouseEnabled = false;
			txt.text = _txtList[index];
		}
		private function add_btn():void
		{
			var index:int;
			var mc:MovieClip;
			
			index = getIndex(_display);
			mc = MovieClip(_display);
			mc.useHandCursor = true;
			mc.gotoAndStop(index == ViewMgr.instance.menuIndex ? "light" : "dark");
		}
		
		//-- Click Handlers --//
		private function click_btn():void
		{
			var index:int;
			
			index = getIndex(_display);
			ViewMgr.instance.setMenu(index);
		}
				
		
		public static const VIEW_NAME	:String = "MAIN_MENU_VIEW";
		public static const LAYER_INDEX	:int	= 3;
		
		private var _txtList:Array;
	}
	
}